home *** CD-ROM | disk | FTP | other *** search
/ Explorers of the New World / Explorers of the New World.iso / pc / exdata.dir / 00723_HYPERTEXT LINKING.ls < prev    next >
Encoding:
Text File  |  1995-09-10  |  2.3 KB  |  77 lines

  1. on isHypertextLink wordNumber
  2.   global clickedTopic
  3.   set wordStyle to the textStyle of word wordNumber of field clickedTopic
  4.   if wordStyle = "bold" then
  5.     return 1
  6.   else
  7.     return 0
  8.   end if
  9. end
  10.  
  11. on goHypterTextLink hypertextWords
  12.   global clickedTopic
  13.   updateRecentChoices()
  14.   set hypertextPhrase to getHypertextPhrase(hypertextWords)
  15.   set clickedTopic to hypertextPhrase
  16.   showTopicText()
  17. end
  18.  
  19. on checkIfClickedHypertextLink
  20.   global clickedTopic
  21.   set wordNumber to the mouseWord
  22.   set clickedWord to word wordNumber of field clickedTopic
  23.   if isHypertextLink(wordNumber) then
  24.     set hypertextWords to getHypertextWords(wordNumber)
  25.     hiliteHypertextwords(hypertextWords)
  26.     goHypterTextLink(hypertextWords)
  27.   end if
  28. end
  29.  
  30. on getHypertextWords wordNumber
  31.   global clickedTopic
  32.   set hypertextWords to [wordNumber]
  33.   sort(hypertextWords)
  34.   repeat with i = wordNumber - 1 down to 1
  35.     if isHypertextLink(i) and not endsWithPunctuation(word i of field clickedTopic) then
  36.       add(hypertextWords, i)
  37.       next repeat
  38.     end if
  39.     exit repeat
  40.   end repeat
  41.   if not endsWithPunctuation(word wordNumber of field clickedTopic) then
  42.     repeat with i = wordNumber + 1 to the number of words in field clickedTopic
  43.       if isHypertextLink(i) then
  44.         add(hypertextWords, i)
  45.         if endsWithPunctuation(word i of field clickedTopic) then
  46.           exit repeat
  47.         end if
  48.         next repeat
  49.       end if
  50.       exit repeat
  51.     end repeat
  52.   end if
  53.   return hypertextWords
  54. end
  55.  
  56. on hiliteHypertextwords hypertextWords
  57.   global clickedTopic, hilitBackground
  58.   set numHypertextWords to count(hypertextWords)
  59.   set firstWord to getAt(hypertextWords, 1)
  60.   set lastWord to firstWord + numHypertextWords - 1
  61.   set the foreColor of word firstWord to lastWord of field clickedTopic to hilitBackground
  62.   waitTicksRoll(20)
  63.   set the foreColor of word firstWord to lastWord of field clickedTopic to 255
  64. end
  65.  
  66. on getHypertextPhrase hypertextWords
  67.   global clickedTopic
  68.   set numHypertextWords to count(hypertextWords)
  69.   set firstWord to getAt(hypertextWords, 1)
  70.   set lastWord to firstWord + numHypertextWords - 1
  71.   set hypertextPhrase to word firstWord to lastWord of field clickedTopic
  72.   if endsWithPunctuation(hypertextPhrase) then
  73.     set hypertextPhrase to removePunctuation(hypertextPhrase)
  74.   end if
  75.   return hypertextPhrase
  76. end
  77.